let Participant = require('../model/Participant');
let printLog = require('../log4j-config');
module.exports = function (req, res) {
    //{ "title" : "test","time": "test","position" : "test","source" : "test"}
    Participant.create({
        name: req.body.name,
        number: req.body.number,
        aid : req.body.aid
    }).then(function (participant) {
        printLog.INFO(`INSERT an Participant(aid = ${req.body.aid}) at IP : ${req.host}`);
        res.status(200).send({succeed : true, participant : participant});
    }).catch(function (err) {
        printLog.ERROR(`ERROR on INSERT an Participant(aid = ${req.body.aid}) at IP : ${req.host}`);
        res.status(400).send({succeed : false, err : err});
    });
}